//
//  CommonViewController.swift
//  Swift 3.0 基础语法
//
//  Created by YYY on 2017/7/17.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

import UIKit

class CommonViewController: UIViewController {

    var backButton: UIButton?
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
        backButton = UIButton(frame: CGRect(x: 0, y: 0, width: 50, height: 30))
        backButton?.setTitle("返回", for: .normal)
        backButton?.titleEdgeInsets = UIEdgeInsetsMake(0, -15, 0, 0)
        backButton?.setTitleColor(#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1), for: .normal)
        backButton?.titleLabel?.font = UIFont(name: "Arial", size: 15)
        backButton?.addTarget(self, action: #selector(backAction), for: .touchUpInside)
        navigationItem.leftBarButtonItem = UIBarButtonItem.init(customView: backButton!)
        //let backBtn = UIButton()
        
        // Do any additional setup after loading the view.
    }
    func backAction()
    {
        navigationController?.popViewController(animated: true)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
